Previous Book Contents Book Index Next

Inside Macintosh: Open Transport /
Chapter 7 - Process Management / Process Management Reference
Functions / Working With Deferred Tasks


OTCreateDeferredTask

Creates a deferred task that identifies a function to be executed at the next deferred task time.

C INTERFACE
long OTCreateDeferredTask (OTProcessProcPtr proc, 
                           void* arg)
C++ INTERFACES
None. C++ applications use the C interface to this function.

PARAMETERS
proc
A pointer to the process callback function you want executed at deferred task time.
arg
A pointer to application-defined data that Open Transport can pass to your callback function. Pass NULL if you do not want this data passed. If you are creating more than one of the same kind of task, you can use different values for arg to distinguish between the tasks.
DESCRIPTION
The OTCreateDeferredTask function creates a deferred task that you can schedule for execution at the next deferred task time. The task contains a pointer to the process callback function indicated by the proc parameter. At the next deferred task time, Open Transport calls your process callback function, passing it the arg parameter and, for the 68000-family ofMacintosh computers only, restoring the A5 global world to what it was when you originally called OTCreateDeferredTask.

This function returns a reference that you can use to identify a task in other deferred task functions. If the return value is 0, then there is not enough memory to allocate the necessary data.

If you want to call Open Transport from an interrupt, you can use this function (and OTScheduleDeferredTask) instead of the standard Deferred Task Manager function DTInstall to create a deferred task that you to call permits Open Transport functions. This allows Open Transport to schedule deferred task processing independently of the underlying deferred task mechanism.

SEE ALSO
To schedule a task for execution at deferred task time, call the OTScheduleDeferredTask function (page 7-17).

To destroy a task created with the OTCreateDeferredTask function, call the OTDestroyDeferredTask function (page 7-18).


Previous Book Contents Book Index Next

© Apple Computer, Inc.
15 AUG 1996